package com.lcm.openapi.core.model;

import cn.hutool.core.util.StrUtil;
import com.github.houbb.data.factory.core.util.DataUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@Data
public class ApiModelField {

    @ApiModelProperty(value = "字段名")
    private String fieldName;

    @ApiModelProperty(value = "字段类型")
    private String fieldType;

    @ApiModelProperty(value = "字段描述")
    private String fieldDesc;

    @ApiModelProperty(value = "是否必须")
    private boolean required;

    @ApiModelProperty(value = "字符串校验")
    private boolean stringCheck;

    @ApiModelProperty(value = "字符串校验")
    private boolean nullCheck;

    @ApiModelProperty(value = "字符串校验")
    private boolean listCheck;

    @ApiModelProperty(value = "递归校验")
    private boolean recursiveCheck;

    public String getFieldDesc() {
        if(StrUtil.isNotEmpty(fieldDesc)){
            return fieldDesc;
        }
        return fieldName;
    }
}
